package com.java.system.common.util;

import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

/**
 * @ClassName: EncryptUtil
 * @Description:
 * @Version: v1.0.0
 * @Author: Shan Feiyang
 * @Date: 2019/9/25 8:50
 * Modification History:
 * Date           Author           Version     Description
 * -------------------------------------------------------------
 * 2019/9/25      Shan Feiyang        v1.0.0         创建
 */
public class EncryptUtil {
    static BCryptPasswordEncoder encoder = new BCryptPasswordEncoder(12);

    /**
     * @param rawPassword     明文密码
     * @param encodedPassword 加密后密码
     * @return boolean
     * @Description 密码校验
     * @author Shanfeiyang on 2019/9/25 8:50
     **/
    public static boolean validatePassword(String rawPassword, String encodedPassword) {
        return encoder.matches(rawPassword, encodedPassword);
    }
}
